package com.googlecode.q2xml.service.jdbc;

import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

public class ASMJdbcTypeMapper
{
	private static Map<Integer, String> types = new HashMap<Integer, String>();
	
	public static String getType(int type)
	{
		String val = types.get(type);
		if (val == null) return "Ljava/lang/String;";
		return val;
	}
	
	static
	{
		types.put(Types.BIGINT, "J");
		types.put(Types.SMALLINT, "J");
		types.put(Types.INTEGER, "J");
		types.put(Types.NUMERIC, "J");
		types.put(Types.BINARY, "Ljava/lang/String;");
		types.put(Types.CHAR, "Ljava/lang/String;");
		types.put(Types.VARCHAR, "Ljava/lang/String;");
		types.put(Types.LONGVARBINARY, "Ljava/lang/String;");
		types.put(Types.LONGVARCHAR, "Ljava/lang/String;");
		types.put(Types.DECIMAL, "D");
		types.put(Types.DOUBLE, "D");
		types.put(Types.FLOAT, "D");
		types.put(Types.REAL, "D");
		types.put(Types.DATE, "Ljava/util/Date;");
		types.put(Types.TIME, "Ljava/util/Date;");
		types.put(Types.TIMESTAMP, "Ljava/util/Date;");
	}
}
